<!DOCTYPE html>
<html lang="en" xmlns:v-bind="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="app">
    <!--    自动渲染template内容，会覆盖app节点下的子标签内容-->
    <div>
        <component></component>
        <Counter></Counter>
    </div>
</div>
<div>
    <component></component>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script>

<!--全局生命组件-->
    Vue.component("component",{
        template: '<button @click="count++">全局——点击{{count}}次</button>',
        data(){
            return {
                count:6
            }
        }
    })

    //局部声明组件
    const buttonCounter = {
        template: '<button @click="count++">局部——点击{{count}}次</button>',
        data(){
            return {
                count:6
            }
        }
    }

    let vm = new Vue({
        // el:"#app",
        data:{
            xyjPrice: 99.98,
            syjnum:1
        },
        components:{
            'counter':buttonCounter
        },
        template:'<counter></counter>'
    })
    vm.$mount("#app")
</script>
</body>
</html>
